package com.acxy.b2b2c.controller;

import com.acxy.ants.core.annotation.Autowired;
import com.acxy.ants.resful.annotation.Controller;
import com.acxy.ants.resful.annotation.POST;
import com.acxy.ants.resful.annotation.Param;
import com.acxy.ants.resful.bean.Page;
import com.acxy.ants.resful.render.Json;
import com.acxy.b2b2c.service.MemberService;

/**
 * @author MrShun
 * @version 1.0
 * @Date 2017-10-10
 */
@Controller("member")
public class MemberAjax {

    @Autowired
    private MemberService memberService;

    /**
     * 获取会员分页列表
     * @param pageIndex 当前页
     * @param pageSize 每页大小
     * @param sortField 排序字段
     * @param sortOrder 排序方式
     * @param filters   分页条件 {}
     * @return
     */
    @POST("/page")
    public Object page(@Param(value = "^(-|\\+)?\\d+$", msg = "only positive numbers can be entered!") int pageIndex
            , @Param(value = "^(-|\\+)?\\d+$", msg = "only positive numbers can be entered!") int pageSize
            , String sortField, String sortOrder, String filters, String tjKey, String keyValue) {
        Page page = memberService.queryPage(pageIndex, pageSize, sortField, sortOrder, filters, tjKey, keyValue);
        return Json.ui(page);
    }
}
